import { register,getCurrentUser } from "../../api/user";
export default {
  namespaced: true,
  state: {
    registerRes: "",
    user:{}
  },
  actions: {
    async registerPost({commit},user){
      const data = await register(user);
      commit("setRegisterRes", data.data);
    },
    // 获取用户信息
    async getUser(){
        const data = getCurrentUser(userType,userId)
        console.log(data)
        commit("setUser", data.data)
    }
  },
  mutations: {
    setRegisterRes(state, data) {
      state.registerRes = data;
    },
    // 设置用户信息
    setUser(state, user){
        state.user = user;
    }
  },
};
